copy needed code from Distributions to improve load time