Blowing away all the old code
First pass at new version. Monads, states, memory handlers.