initial attempt at problem 8