added loads of comments, thrown out some code garbage, etc. etc.. Looks like material for a release!