Updated shape-fitting from master