refactor, add tests, update readme.

Should now produce expected results on all tests.
lol, i recently started to include one because too much trolling about it. will add one later.