fixed logic
changed var name
added notes