Rewrite callback code