add code from usc 571 class