refactored code: added utils