Maintenance, cleanup & message logger

Mostly maintenance work - removing unused temporary MainForm, cleaning
up code, simplifying some functions, etc.; also added logging
functionality and message log form