Small point, but you dont need chomp with to_i as it will take off the newline character..