Homework 6 for CS311