organizing the code between the chain state builder and worker