new version, with some refactoring and a new defree of freedom for the heat exchangers