fix cyclomatic complexity (jshint)