Snake drawing inversion of control example