Completes homework 3