Moved some functions around in util.