Cleaned up for readability

Partly re-wrote and changed variable names for readability.