updated to be suitable for corrbfbf and corrmnebf. improved variable names