Made some JS tweaks to make it work

Here it is