adding internal functions for shapeFit