Small changes, including some tests for proper distribution.