refactor constraint matching, add checking for placeholders