add tests, travis, refactoring