More refactoring and clean-up.
Finish implementing base working prototype.