Refactor parsing of annotations