worked further on lecture 5/6/7 slides