Add Application.DoEvents to prevent freezing