add docs for before/after functions