Huge refactor, add tests, update README, put on travis