Reduce number of nested levels.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
Merge pull request #840 from Tithugues/reduceNestedLevels

Reduce number of nested levels.