moved utility functions to separate file