Update doc and improve tests