Pretty much done; need to add log likelihood and run some more tests