Some cleanup to make the code more in line with Ruby style.