added code from lab 2