Shuffling of code to avoid checking if_array() twice.