demo code for lecture 4