Half of chapter 4. Before rewritting tup+
Finished chapter 4