Refactored operation check.