modified for lecture/exercise