Slight tweaks to scanning logic