woo, working for 2d likelihood and gets the right answer. added stop condition (i>n*H)