working tested selection with prefix linearisation