Working code

I think this is now fully working. Unfortunatly the algorithim as give
is a little vague in places, and we seem to have just skipped over it in
my written notes. Where we move on in the example in the notes does not
match what this puts out, and looking over it, the example only makes
sense stopping where it does to better demonstrate aggresive dead code
elimination.