added sort plotting main