Cleaned up the distribution calculations and scripts