Refactored code to use new Panel module