Nearly sorted out the string variables fixing them as numerals. They change state as they pass between HTML and the JS world and back.