Copied and refactored Lesson 2, 3, 5, 6 and 9