Adding code from video tutorial.