final fitting code