substantial rewrite. added (simple) recursion to programming rules. slightly nicer interface.