Reduce nested levels.

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

Reduce number of nested levels