Reverted scoping. Work on something better