Implement reverse_array