refactored layouts and contollers