Refactoring files controller