preliminary refactoring for the spooler