Sort array
Edit function