modified C++ code for get_codes_in_disc to better filter false positive