ndb implementation