replace code from tutorial part 7