Simplified js using named functions in the event handlers.