Moved utility stuff to util.js