Edited type-matching algorithm