I suggest removing this line and use (work++ % 16) on line 792. It will have the same effect and we'll have all processEvents() calls at a single place.