Struggling through homework 3