Message count update logic improved

- Removed unwanted synchronisations
- Count update logic improved to avoid unexpected behaviour in multi threaded environment
- Message count update logic moved to a separate class, MessageCountFlusher