first changes to optimizeModel