[MERGE] fix missing ret value assignation

Signed-off-by: David Goulet <dgoulet@efficios.com>
[MERGE] more refactoring.

Signed-off-by: David Goulet <dgoulet@efficios.com>