implement ex6. still have a problem: can only have 1 producer. WIP