small refactoring of handling before/after blocks and also add missing docstrings
small refactoring of handling before/after blocks and also add missing docstrings

bakkdoor/fancy,bakkdoor/fancy,bakkdoor/fancy,bakkdoor/fancy