Re-implement batch using extracted libraries.

Closes #74.