added code documentation
code cleanup