new fit code using max entropy model