add js import and fix init script so it actually works, was not accessing indexes, just values before