refactored, finished up part 2 of tutorial