Fast sort implementation