made efficient messages handler