Copy of Dan's ndhist repository