Jquery Novice to Ninja - Simple Accordion - toggleClass "active"?

Hi I have been going through the book Jquery Novice to Ninja. Just a question about Chapter 5 - Simple Accordion.

How do you add an “active” class to the open accordion and remove it when closed?


$(document).ready(function(){
  $('#celebs ul > li ul')
    .click(function(e){
      e.stopPropagation();
    })
    .filter(':not(:first)')
    .hide();
    
  $('#celebs ul > li').click(function(){
    var selfClick = $(this).find('ul:first').is(':visible');
    if(!selfClick) {
      $(this)
        .parent()
        .find('> li ul:visible')
        .slideToggle();
    }
    
    $(this)
      .find('ul:first')
      .stop(true, true)
      .slideToggle();
  });
});

thanks for any help