refactoring controllers/layouts