Added many threads; much more error checking; main loop exits too soon