Code which backs surlyfritter.appspot.com