implemented all of lesson 5