Fix comments, add logging