Refactor functions into files.