Completed assignment 2

Completed the assignment based on the mean caching sample. Complete with
comments!