handle the event using a lambda