How to let category and subcategory control which single post template should load?

Hi,
here is the scenario
I have 2 categories and each has 5 or more subcategories

cat1 - veg (subcat: 1)carrot 2)tomato etc
cat2 - fruit (subcat: 1) apple 2) orange

I have created for each cat 1 & 2 single templates

single-veg.php, single-fruit.php

So, does anyone know what should be the correct function to load single-veg.php on all posts which belong 'veg', 'carrot' etc category??

This is what I have adopted, but I think there must be a better way.. and of course, if you notice anything wrong with the code... I am newbie

/** Get Post Category and sub category */

function post_is_in_descendant_category( $cats, $_post = null )
{
	foreach ( (array) $cats as $cat ) {
		// get_term_children() accepts integer ID only
		$descendants = get_term_children( (int) $cat, 'category');
		if ( $descendants && in_category( $descendants, $_post ) )
			return true;
	}
	return false;
}

/** Conditional Templates for Single posts */

function template_change( $template ){

    if( is_single() && (post_is_in_descendant_category('12')) || in_category('12') ){
        $templates = array("single-veg.php");
	}

   elseif( is_single() && (post_is_in_descendant_category('17')) || in_category('17') ){
        $templates = array("single-fruit.php");

    } elseif( is_single() && in_category('articles') ){
        $templates = array("single-articles.php");

    }
    $template = locate_template( $templates );
    return $template;
}

add_filter( 'single_template', 'template_change' ); //'template_include'/'single_template'