Rewrote scoping.