Move inner functions to namespace scope in components and pages