(WIP) Chapter 4 source code

Do not merge, work in progress