Reduce nested levels.
Remove unused local variables.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>