modified some more functions to introduce mongodb