more control for before callback