Refactor and add 'annotate' parameter to toggle annotation output