refractored some utility methods into Utility.java