refactoring for new app engine release.