Implementing fourth tutorial from Chapter 6 (wip).