move annotate1 as inner function