Updated lecture code