replaced println with log entries. Some cleanup