More documentation.
Also, removed some code which was not being used.
No functions were removed, only have removed un-used variables and one instance of a variable being assigned to itself.