added notes to code