added comments/documentation
code cleanup