added msg_count as argument
updated it