Recfactored to usage of mongodb