Corrected mistakes and add comments