corrects program so that it passes all 8 tests