Moved functions into separate files.