Minor refactoring of distiller and tests.