Merge "Non-functionally refactor scanning logic" into main