refactored so that key does not depend on appengine