Moved utility functions to separate file