cleaning and refactoring code for Intervention#match