Right, I should also check what happens when the input array is empty (has size 0).