modify to enhance error message to follow CLHS recommendation
modify to add more comments