Tidied up event handlers.