finished tutorial code