simple working version (re #335)