Simplify scan_past logic and clarify comment