Cleaner way to check for match