eliminate test_each and second case statement