In photosynthesis, what are the main functions of the light-dependent reactions?