Tutorial code cleanup