renamed variables

Signed-off-by: gwendoux <gwenael.doux@cncc.fr>
externalize function

Signed-off-by: gwendoux <gwenael.doux@cncc.fr>
Added test

Signed-off-by: gwendoux <gwenael.doux@cncc.fr>