Moved chapter 1 code into module