moved some functions to break up the monster Utils.Misc