few modifications to code with commits
complete comments