refactors mongo