refactor, add tests, update readme.

Should now produce expected results on all tests.
> I personally prefer being explicit on things like this and rather have it fail on nested arrays

sounds good, I'll remove. I didn't see that comment before my last