chain events, rather than using an if statement in one event handler.