Fixed bugs in spec and module.
Added contingency table statistic and tests.