added missing documentation and removed redundant code