Made a few derpy mistakes; fixed a few derpy mistakes.
Added comments to some possibly less obvious sections of code.