API code cleanup - Chapter 9