Re-implement merge using abstracted libraries.

Closes #76.