Refactor & Test

**Ready for review**

This is about as far as I want to take this before I start a new PR.