Moved GUI-modifying code from the scanner thread to the paint routine and added inter-thread communication mechanisms.