added sort algorithm