refactored functions to util