Code sample from PRFT LnL June 2013