## 5 Conclusions  
As highlighted in the Introduction, the usual practice is for the whole building to undergo renovation with the same thickness of insulation and the same type of windows. However, not all dwellings require the same level of insulation or windows to achieve the NZEB objective. Furthermore, excessive, unnecessary insulation comes at a higher cost and can lead to an increased risk of overheating in summer. Thus, this article proposes a methodology for optimizing the building envelope with a double objective: to reduce the total heating demand of an apartment block and to reduce the differences in these heating demands from one dwelling to another. In addition, in order to not affect the energy performance of the building in summer, the new insulation should be placed on the outer layer of the exterior walls and roof, thus favoring the thermal inertia of the building.  
To implement this methodology, the demonstration building of the European RECO2 ST project in Cadiz, Spain, is used as a case study. It is a five-story residential building with 28 dwellings for which a complete renovation of its building envelope is planned.  
The Case Study presented in this article has identified the causes of the highest heating demands are mainly the following: north facing dwellings with little solar gain in winter, as well as a low compactness factor.  
The proposed methodology requires first identifying both the facade walls and windows that might have a different construction solution to the rest and the possible levels of insulation and glazing. In this sense, different construction solutions are possible depending on the orientation and on the floor of the building in question. It is important that this first step is carried out together with the team of architects and engineers responsible for the renovation of the building to ensure that the aesthetic criteria as well as all of the construction regulations are met. Second, for each opaque element or window, the proposed methodology offers three different options. Thus, given the number of building elements considered, and the number of options for each of them, the total number of possible combinations was 531,441.  
The proposed methodology applied for this building, based on a resizing of the sample in four iterations, has enabled the optimal solution to be reached in just 934 simulations. This limited number of simulations performed has been thanks to the novel bootstrap resampling technique developed by the authors and presented in this article for the first time. The optimal solution makes it possible to reduce both the total energy demand of the building and the disparity in demands between dwellings by 66% with regard to the initial values.  
Both the methodology explained here and the idea of proposing different solutions according to facade, orientation, type of window, etc. can easily be used in future interventions in buildings with results that guarantee the best possible intervention for each specific dwelling within an apartment block.  
Conceptualization, F.J.S.d.I.F.; Data curation, E.A.R.J. and A.R.P.; Formal analysis, F.J.S.d.I.F., A.R.P. and J.M.S.L.; Investigation, E.A.R.J.; Methodology, F.J.S.d.I.F. and E.A.R.J.; Supervision, F.J.S.d.I.F., J.M.S.L., and M.K. All authors have read and agreed to the published version of the manuscript.  
This work has been developed within the framework of the research project RECO2 ST-Residential Retrofit assessment platform and demonstrations for near zero energy and CO2 emissions with optimum cost, health, comfort and environmental quality. ReCO2 ST has received funding from the European Union's Horizon 2020 research and innovation program under grant agreement No 768576.  
Not applicable.  
The authors would like to thank to Cadiz City Council for their technical support in the geometric and constructive description of the building used as a case study.  
The authors declare no conflict of interest.