Cleaning code

Still no logging and yet to be tested for program pop-ups.  Will test this evening.