generalized new grab tool code