cleaned up implementation of message matching