Some minor fixes and added updated comments.
Removed a minor bug in msg_buffer functionality. This still needs extensive testing!!