Fixes #6327 Mostly. Commenting, fixes warnings, and a rogue print_r