Added better support for JS validation