refactored code in the Utility class