Shayan/pipeline sort