Updated some of the code for readability.