Modularize.

Closes #4.