exp branch; fitting code