chapters 0-4: tidying