Fix cyclomatic complexity findings (fixes #300)