semilinear: some refactoring of template arguments