Multifunctional Role of Nanostructured CdS Interfacial Layers in Hybrid Solar Cells