Fix: add generic doc and uniformize code