refactor and fix double-processing of type params