Reversing damage!

Had some weird issues last night where I lost some code, had to cobble
things together from various revisions...
have now repaired most of the damage!