simplify code, decrease cyclomatic complexity from 11 to 10 by
extracting methods