Add some comments to JS popover function