Finish and include new tests.

I finished up the refactor - the last pull request was rather incomplete. I've tidied up the classes, ironed out some bugs and crucially written some tests! Hope you find it helpful.

Maybe you'd consider tagging this the 1.0 branch on packagist, or re-versioning in some fashion? I'm keen to pull this package in for a current project!

Thanks :)