Proper profile sorting.

Fixes #259

Also better property_details cursor hygiene.