added code for 4th lecture