modified for lecture 3