Moved utility functions to their own file