Handle big Q ties and refactor.

Fixes #15.