Code for lesson 4