Updated code to match the video.