refactored message adapter into seperate class