A few refinements was made in order to update th applyhmm branch