appengine refactor