Avoid nested returns.
Compound expression instead of block.
Avoid a pointless typedef.
Merge pull request #7 from robrix/cyclomatic-complexity-minimization

Cyclomatic complexity minimization