removed copy of MongoConnection and some minor refactoring.