modified the comments and set the error flags