Refactored sortable helper