Moved functions and structs into their own files.