diff --git a/annogen.py b/annogen.py
index a43fcb509763a2762caf85cc33a0c45fe1c45220..22eb1126878173ff8f43a65724f9b252c368d80b 100755
--- a/annogen.py
+++ b/annogen.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-program_name = "Annotator Generator v0.585 (c) 2012-15 Silas S. Brown"
+program_name = "Annotator Generator v0.586 (c) 2012-15 Silas S. Brown"
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -490,6 +490,8 @@ and under iOS / Application choose Single View Application.
 Fill in the dialogue box as you like, then use this file
 to replace the generated ViewController.m file.  You should
 then be able to press the Run button on the toolbar.
+Tested on an iOS 6.1 simulator in Xcode 4.6 on Mac OS 10.7
+(hopefully compatible with later versions too)
 
 */
 
@@ -795,7 +797,11 @@ if ios:
     self.myWebView.scalesPageToFit = YES;
     self.myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
     self.myWebView.delegate = self;
+    [self.view addGestureRecognizer:[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeBack:)]];
     [self.view addSubview:self.myWebView];
+    [self loadInitialPage];
+}
+- (void)loadInitialPage {
 """
   ios=ios.replace('\\','\\\\').replace('"','\\"').replace('\n','\\n')
   if ios.startswith('<'): c_end += '[self.myWebView loadHTMLString:@"'+ios+'" baseURL:nil];'
@@ -805,6 +811,12 @@ if ios:
     c_end += '[self.myWebView loadRequest:[[NSURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"'+ios+'"]]];'
   c_end += r"""
 }
+-(void)swipeBack:(UISwipeGestureRecognizer *)recognizer {
+    if (recognizer.state == UIGestureRecognizerStateEnded) {
+        if ([self.myWebView canGoBack]) [self.myWebView goBack];
+        else [self loadInitialPage];
+    }
+}
 - (void)webViewDidFinishLoad:(UIWebView *)webView
 {
     [webView stringByEvaluatingJavaScriptFromString:@" """+jsAnnot("window.alertTitle=f(e.firstChild)+' '+f(e.firstChild.nextSibling); window.alertMessage=e.title; window.location='alert:a'","var texts,tLen,oldTexts,otPtr,replacements; ","texts = new Array(); tLen=0; otPtr=0; ","oldTexts = new Array(); replacements = new Array(); tw0(); window.location='scan:a'",r"""var i=otPtr;while (i<oldTexts.length && oldTexts[i]!=c.nodeValue) i++;if(i<replacements.length) {var newNode=document.createElement('span');newNode.className='_adjust0';n.replaceChild(newNode, c);var r=replacements[i]; if(!inLink) r=r.replace(/<ruby title=/g,'<ruby onclick=\"annotPopAll(this)\" title=');newNode.innerHTML=r; otPtr=i;} else if (tLen < 1024) { texts[texts.length]=c.nodeValue;tLen += c.nodeValue.length;} else return""")+r""""];