Moved some methods into Util