added some notes to code