Improve processEvent