Code consolidatoin regarding message read/write.