switches to MongoDB and does some small corrections and refactorings