Flint Hills, environmental groups settle on plans for refinery upgrade