optimize panel positioning