A microfluidic system comprising a plurality of photochemical reaction stages, the microfluidic system comprising:
- a computational processor for executing an algorithm;
- a first plurality of electrically-controllable photochemical reaction stages, each of these connected in series;
- at least one additional electrically-controllable reaction stage, and
- a series of controllable interconnections for connecting the electrically-controllable photochemical reaction stages;
- wherein the algorithm executed by the computational processor to control controls the plurality of electrically-controllable photochemical reaction stages and the controllable interconnections to perform a plurality of reactions in sequence.