Cleaned up variable names. Rewrote some comments