used isNaN() test to prevent unecessary code from executing