WIP: add javascript implementation