Added some commenting and fixed variable bits.