add js, update template and code

basically, quite a few updates as it didn't work