How to modify list categories code?

I’m now using the following code which allows me to format the list as required:

<?php   if (is_category( )) {

        $thiscat = get_category( get_query_var( 'cat' ) );
        $catid = $thiscat->cat_ID;
        $parent = $thiscat->category_parent;

        if (!empty ($parent) ) {
        //child category pages

        $catlist = get_categories(
        array(
        'child_of' => $parent,
        'orderby' => 'id',
        'order' => 'DESC',
        'exclude' => $catid,
        'hide_empty' => '0'
        ) );

        //widget title
        echo '<h2 class="widget-title"><span>Related Products</span></h2>';

        //categories list
        foreach ( $catlist as $category ) {
        echo '<ul>';
        echo '<li><h3 class="entry-title"><a href="' . get_category_link( $category->cat_ID ) . '" rel="bookmark">' . $category->cat_name . '</a></h3></li>';
        echo '</ul>';
        }
        }

        else {
        //parent category pages

        $catname = get_cat_name( $catid );

        $catlist = get_categories(
        array(
        'child_of' => $catid,
        'orderby' => 'id',
        'order' => 'DESC',
        'hide_empty' => '0'
        ) );

        //widget title
        echo '<h2 class="widget-title"><span>' . $catname . '&nbsp;Products</span></h2>';

        foreach ( $catlist as $category ) {
        echo '<ul>';
        echo '<li><h3 class="entry-title"><a href="' . get_category_link( $category->cat_ID ) . '" rel="bookmark">' . $category->cat_name . '</a></h3></li>';
        echo '</ul>';
        }

        }

} ?>