sample code from class lectures