Code cleanup and added ILogger