Move util functions into utils.js.