Add some comments to JS function