Finished code for BasicTutorial2.