almost got js working