Move functions out of module.exports{}