added logsurf and markov_pi fcns