Logix sort implementation