Requre $type parameter to be of type array.
Split more out of the dreaded do_root() function, it's finally becomming less of a mess