Cleanup of some of the mongo code