Factor - reuse code from InferSeq