rough first pass complete

A first pass is complete, some restructuring and introduction of tests
is required, but that'll happen once I learn a little more on how to
structure a project like this.