fixed the test failure, and finished rest of the assignment