you should error if the array is empty too with a good error message.