small refactor to make testing easier
Added some tests
Added travis config