Added Mongo backend; fixed many little issues