sorting and array all working