Refactored loose end handling and added blocked end handling.

* All loose end methods are now helpers that point to general untidy methods which support both loose and blocked ends.

* Added support for dealing with blocked ends.

* Updated the basic generator to call the general tidy method to clean up both loose and blocked ends.

* Removed a comment from the main script regarding tidying.