Adding code from past lectures.