Documentation added
removed redundant code.