Relocated utility functions into a separate file