refactored mainview and buttonpanel