Removed remaining old style distribution code (we can get it back from cvs if necessary). Updated error handling. Added better chi-squared tests.