Merged in annotations code, but left it deactivated. Also copied several other changes from the annotations code