fixed cyclomatic complexity #3