The rewrite was over complex and large. This made it smaller and simpler.
Fixes #86 (closed) #85 (closed) #83 (closed)