Remove some code duplication
Add osx platform to .travis.yml