Mongo Implementation +optimization + code cleaning