My version of the solution to CS169.1x Homework 4