finished group_warping function, needs debugging