delete.php: Bug #1 pass

fixing Bug #1
Also minor refactor and obfuscation.