Remodelled to use mongoDB