Switch to producer/consumer thread model