Add support for before and after callbacks