Minor code restructuring
Removed minor ambiguity
[minor modification]
Added documentation comments
[minor bug fix]