copied batch reactor, as an example