resolve for pattern matching in progress. does not work yet.