Update error message and improve comments.