tidied utils.js