draft of sort kernel