Add doc and tests