Revamped code; Completely using mongodb. Added flask server