improved rest interface and matching logic