Move all declarations into the application tag

Stuff works less well when the XML is poorly formed.