Updated code for snippet09.