Factor utility functions into a seperate module