Updated JS to accept input