following parts 8 and 9 of the tutorial