Refactor Travis test script