Code cleanup for MainForm onRefresh event.