rewrite for GAE