API code cleanup.