Started chapter 7 (refactored helper functions to a separate file)