beginnings of an answer to assignment 8