Add Travis CI integration
Rewrite upgrade code to be testable