added some comments
added needCommitToList variable and comments
added dealing with function parameters and local variables