refactored out orm and ndb