Update the JS thanks to issue raised by Tom in comments