add abstract quick sorter for common logic