moved functions to utils