the only binding that was needed was the debug info binding:
<?php echo WA_DFP_AllUploadsDebug(); ?>
the other bindings are not needed
you don't need to detach the page from the template. the other code does not need to be right at the </body> tag, just as close as is possible.