migrated some functions to utils