Added and modified code for Part 2 of this tutorial