Refactored to use ndb, + stub tag handling