Clarified some variable names, simplified certain statments.