More scoping and data formatting