modernize distribution
factor out duplicate code
version 0.02