Add annotation functionality to ranges.  Refactor some related code.