Better gap detection