Updated fetch_array

Let it take a second parameter for the result type to return.