integrating annotate and invoke function