Refactoring utils in utils.sh