finished added functionality for lesson 4