added sort and remove duplicate command