refactor
modify to refactor types and type matching in function specialization
slight change