some working version but too complex