Move namespace declarations to top to prevent ordering issues