Complete the implementation and add comments

Signed-off-by: Axel Davy <axel.davy@ens.fr>