Added processEvents