refactoring cookbook to work with supervisor