adding before and after hooks