Use isFinite instead of isNaN