Removed unneeded variables.
Added documentation.