Some stuff for calculating E values. Added to canonical program