finished event loop part of program 6