added some code for consumer