Some more changes to JS implementation