Code semi works on GAE trying to port ot aws