Modified gap code to be more rigorous about runs of N's