Code reorganization.  Closes #11.