Minor refactoring.

Signed-off-by: Jerome Maloberti <jmaloberti@gmail.com>
More important refactorings.

Signed-off-by: Jerome Maloberti <jmaloberti@gmail.com>