--- a/examples/web_framework/web.krb
+++ b/examples/web_framework/web.krb
@@ -21,20 +21,61 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
 
+
+#
+# process($starting_tables, $template_name) taking (db_cursor, starting_keys)
+#
+# This is the top-level goal called by the wsgi application.
+#   Input goal arguments:
+#     $starting_tables      - a tuple of table_names that keys will be
+#                             provided for when the plan is called (e.g.,
+#                             ('movie',)).
+#     $template_name        - the filename of the template file to use
+#                             (e.g., 'movie1.html').
+#   plan arguments:
+#     db_cursor             - an open cursor to the database.
+#     starting_keys         - a dict mapping the table_names given in
+#                             $starting_tables to their key values (e.g.,
+#                             {'movie': 4}).
+#   plan return:
+#     The plan returns the 3-tuple that can be directly returned from the
+#     wsgi function.
 process_retrieval
-    use process($starting_data, $template_name) \
-        taking (db_cursor, starting_data)
-    when
-        !format_retrieval($starting_data, $template_name, $needed_data) step -1
+    use process($starting_tables, $template_name)
+        taking (db_cursor, starting_keys)
+    when
+        !format_retrieval($starting_tables, $template_name, $needed_data) \
+                step -1
             return $$(data)
-        !database.get_data($starting_data, $needed_data)
-            data = $$(db_cursor, starting_data)
-
+        !database.get_data($starting_tables, $needed_data)
+            data = $$(db_cursor, starting_keys)
+
+#
+# format_retrieval($starting_tables, $template_name, $needed_data)
+# taking (data)
+#
+# This creates a plan to render the indicated template.
+#
+#   Input goal arguments:
+#     $starting_tables      - a tuple of table_names that keys will be
+#                             provided for (e.g., ('movie',)).
+#     $template_name        - the filename of the template file to use
+#                             (e.g., 'movie1.html').
+#   Output goal arguments:
+#     $needed_data          - a descriptor of the data that will be needed
+#                             by the plan.  This is ready for input into
+#                             the sqlgen/database.get_data goal.
+#   plan arguments:
+#     data                  - the dict returned by the
+#                             sqlgen/database.get_data plan containing the
+#                             values of the $needed_data.
+#   plan return:
+#     The plan returns the 3-tuple that can be directly returned from the
+#     wsgi function.
 format_retrieval
-    use format_retrieval($starting_data, $template_name, $needed_data) \
+    use format_retrieval($starting_tables, $template_name, $needed_data)
         taking (data)
     when
-        #!get_context($starting_data, $template_name) as $starting_data_plan
         $template = get_template($template_name)
         $elements = structure($template)
         !render_elements($elements, $needed_data) as $render_fn
@@ -42,8 +83,26 @@
         return '200 OK', [('Content-Type', 'text/html')], \
                $template.render($render_fn, data)
 
+#
+# render_elements($elements, $needed_data) taking (template, data)
+#
+# This creates a plan to render the elements within an HTMLTemplate.
+#   Input goal arguments:
+#     $elements             - tuple of element names, which are each
+#                             two-tuples of the form: (element_type, name).
+#   Output goal arguments:
+#     $needed_data          - a descriptor of the data that will be needed
+#                             by the plan.  This is ready for input into
+#                             the sqlgen/database.get_data goal.
+#   plan arguments:
+#     template              - the HTMLTemplate object.
+#     data                  - the dict returned by the
+#                             sqlgen/database.get_data plan containing the
+#                             values of the $needed_data.
+#   plan return:
+#     The plan returns the rendered html as a string.
 render_elements
-    use render_elements($elements, $needed_data) \
+    use render_elements($elements, $needed_data)
         taking (template, data)
     when
         python needed_data = []
@@ -62,20 +121,43 @@
     with
         for render_fn in $render_fns: render_fn(template, data)
 
+#
+# render_element1($element, $needed_data1) taking (template, data)
+#
+# This creates a plan to render a single element within an HTMLTemplate.
+#   Input goal arguments:
+#     $element              - a single template element as a two-tuple of
+#                             the form: (element_type, name).
+#   Output goal arguments:
+#     $needed_data1         - an individual descriptor item of the data
+#                             that will be needed by the plan, or None if
+#                             no data is needed.  This may describe an
+#                             individual (unique) data item or a multi-row
+#                             set of items.  This is ready for use in the
+#                             top-level descriptor to the
+#                             sqlgen/database.get_data goal.
+#   plan arguments:
+#     template              - the HTMLTemplate object.
+#     data                  - the dict returned by the
+#                             sqlgen/database.get_data plan containing the
+#                             value(s) of the $needed_data1.
+#   plan return:
+#     None                  - the plan modifies the HTMLTemplate object in
+#                             place and does not return anything.
 render_element1_del
-    use render_element1((del, $_), None) \
+    use render_element1((del, $_), None)
         taking (template, data)
     with
         pass
 
 render_element1_sep
-    use render_element1((sep, $_), None) \
+    use render_element1((sep, $_), None)
         taking (template, data)
     with
         pass
 
 render_element1_con
-    use render_element1((con, $name), $name) \
+    use render_element1((con, $name), $name)
         taking (template, data)
     when
         check $name.find('.') == -1
@@ -84,7 +166,7 @@
         getattr(template, $name).content = str(data[$name])
 
 render_element1_con_dot
-    use render_element1((con, $name), $real_name) \
+    use render_element1((con, $name), $real_name)
         taking (template, data)
     when
         ($real_name, $index) = $name.split('.')
@@ -94,7 +176,7 @@
         getattr(template, $name).content = str(data[$real_name])
 
 render_element1_rep
-    use render_element1((rep, $name, *$children), ($name, (), *$child_data)) \
+    use render_element1((rep, $name, *$children), ($name, (), *$child_data))
         taking (template, data)
     when
         !render_elements($children, $child_data) as $detail_fun