move global functions to utils