final document and code