changed readFile in prog6 to do work in the event loop