Improve tests, add test coverage, and fix issue #5

Also add travis support.