Refactoring for MongoDb and completed tasks