app class created and tidying up the code