documentation added, while understading the code.