[refactor] reduce cyclomatic complexity