add working code with documentation and testbench