Extract complex condition as function.