fixed the mistake and add more comments