restructuring, cleaning up, and setting up mongoose