moved some functions to nabc_corrnorm.R