Added "before" and "after" handlers

To be called before or after original function