Corrected algorithm for enqueuing scan nodes. Commented direction control.