add callback functionality back into rewritten plugin