Refactoring page and file controllers. Optimize layout