reduce cyclomatic complexity