replace code from tutorial part 5