refactored schema and main, added flask-mongoengine for session