Some refactoring and files controller