refactor, add tests, update readme.

Should now produce expected results on all tests.
perhaps, I didn't really look at how you were doing it before too closely. I personally like the descriptive coding style but whatever. feel free to revert back to that if that's what you want.