speed improvements by reducing the number of repeated events