Refactor some files