Working copy of homework 3 with documentation. Passes all tests.