Add tests and implementation for spooler.