finnish up mongo test script / cleaned some code