fit recursive class function