all test cases except for #6 working!