add working version — has been tested twice.