Speed ups to the similar image annotation mechanism.