Some improvements, and fix spoolgen.php