I see, it should be OK to check the initial frame but the final frame, since isDefinedAt only checks the frame class and since the final class should the same as for the initial class.

BTW, even though it won't make a difference, I feel like it would be more correct to check the final combined frame rather than the initial frames, since the final frame is what we're planning on formatting.