Add advanced parts of tutorial code