Updated logic and added destroy event.