commented the code
added tondoc documentation