These functions should be out of this file, to an `utils.js` for example.