Picked a few changes from the 'unbreak annotator' project.