Moved some code to util.clj