2nd branch

all of this stuff should probably be wrapped in the function that you're module.exporting.