working version with points