Refactored the way we are connecting to MongoDB