Better error handling and ability to clear matches