Adding code from lab 7