Moved utility functions to a new file.