Bugfixes and improvements, rebased to latest code from Hypothes.is's fork

Hi,

In order to finally merge our work back to Annotator, I have started to re-base our changes to latest upstream code.
These commits are the result of that.

I am separating our changes to small, documented, tested change-sets, so you can individually review/cherry-pick them, as you see fit.

(This branch is based on the range-normalization-fix branch, which will hopefully be merged really soon.)