Tweaks to sorting/ordering and security API