working version for assignment2. 10 messages sent in loop