Added code for Part 3 of the series