finished refactoring framework for likelihood

commence regression testing.
fixed a bug in the likelihood.

unit tests for gamma seem to be passing now.