Adds scope and properly implemented stack.