put Nhmax as an input parameter in run