Tidied up event pump.