add before and after callback