Sync with 2.4 [Fixed cyclomatic complexity issue.]