Refactored to event based handlers