this works for all of the test cases