Added before and after handlers