Refactored and cleaned up code.

I also began adding comments to help any new coders that might be
looking at it