Moved JavaScript helpers to utils.js