Added Sort, Keep and Drop, with some other minor changes