Refactor: Move utility functions to helper.js