Showing nested links in Drupal but still add classes to list elements Very new to Drupal and a bit confused.

In order to render a menu in my theme I've been using this:

print theme('links', array('links' =&gt; $main_menu, 'attributes' =&gt; array('id' =&gt; 'main-menu', 'class' =&gt; array('links')))); 


That works a treat and gives me an extra class on the first and last list items, which I need for styling. It doesn't, however, show any of the nested sub menus.
So I found this that again, worked like a charm Show all nested menu links in Drupal 7 and shows all the top-level links in the main menu and the nested ones too.
This doesn't give me the extra classes on the first and last list items which I need.
Is there any way to use the code from the answer above and give the extra classes on the list items?

Thanks muchly
Check out the Menu Attributes module. Here is a quote about it (from the module's project page):

This simple module allows you to specify some additional attributes for menu items such as id, name, class, style, and rel.
You should use this module when

You want to &quot;nofollow&quot; certain menu items to sculpt the flow of PageRank through your site
You want to give a menu item an ID so you can easily select it using jQuery
You want to add additional classes or styles to a menu item