Move generic helper functions into Util namespace