#20 moving code to modProcessEvents