use begin and end events