refactoring calling autofit.