Refactors the files