Corrected some syntax and commented

Fixed and cleaned up some syntax.
Added comments on given sections, functions to lines.