refactoring, add tests, add fixture, prepare to travis-ci