die "$type doesn't exist in %{\$hashref}" or isnt a hash ref unless exists $hashref->{$type} && ref $hashref->{$type} eq 'HASH';