Code refactor and tidy for UtilityFunctions