Moved the rest of the code to the library; added more tests
Merge pull request #21 from pleary/master

Moved the rest of the code to the library; added more tests