Moved utility functions into separate files.