Sort values to simplify processing

Also add comments to rx/extensions.js