move util methods to utils.js