break out feature hfile writing function