Environemnt settings added for foreman deployment
Refactoring of MongoDB code to use external functions