added sort fucntion