Add lecture8 code