refactoring controller/view/layouts