Move functions and relevant code into their directories/files.
Move functions and relevant code into their directories/files.