Refactor

A lot of cleanup - now (hopefully) the marginal density estimation code is readable. Also eliminated all of the vector types to make integration with a python library easier.