transferred variable comparison functions from checkLD to here