Updated for google apps engine