Using Shortcode to Grab Archive Listing, Separate by Year

I found this answer: http://www.stemlegal.com/strategyblog/2011/wordpress-wednesdays-better-archive-lists-in-wordpress/

And the final code looks something like this:

function getarchives_filter($where, $args) {
    if (isset($args['year'])) {
    $where .= ' AND YEAR(post_date) = ' . intval($args['year']); }
    return $where;
}
add_filter('getarchives_where', 'getarchives_filter', 10, 2);

function my_archives($params, $content = null) {

    extract(shortcode_atts(array(
    'type' => 'style1'
    ), $params));

    $currentyear = date('Y');
    $years = range('2012',$currentyear);
    foreach($years as $year){
        $archive = wp_get_archives( array( 'type' => 'monthly','echo' => 0 ,'year' => $year) );
        if(!empty($archive)){
            echo '<ul>';
            echo '<li>'.$year.'</li>';
            echo $archive;
            echo '</ul>';
        }
    }

}
add_shortcode('archives','my_archives');