There are a couple of different ways to do marginalization, specifically how to express the "prior" factor from the marginalization. What is in the paper is, I believe, fairly straightforward, but I think I am using an older (and harder to understand) method in the code. It should really be doing the same things as in the paper.