updated to use also use heldout. plus bug fix