added probability distance and EM loop