refactor to files