Finished cleaning up code and renamed variables for increased
readability.