Duplicates processEvents() calls
Removes useless loops