finalized documentation and code