reversing the array elements