Added comments, increased readability.