finish lecture 4 code fragments