Moved main view code to app class