moved the callbacks around, changed module.exports into an entire function