added functions to producerConsumer