implemented local message counting system