improved example producer and consumer