HW2: Complete assignment