both snippet and github 1st working version