Rearrange case3 and case4 implementations.