Added some comments and a log message