COMP 429 - code given in class