comments and corrections on the code