Copied code for assignment from Professor Gurka's handout.