Some changes in logging and main.