rewrite of the previous geom function