more to JS re-write