New version almost complete

I'm writing this again from the ground up. Now that I have a working
'prototype' I can begin to fix it.