Add optimization by pruning by event type