Assignment 7 re-write