Refactor messagetable

Change-Id: I09c9d14a7ee23fa1bc55c34fe3328f356faab28a