Fixing up to run on app engine