Fixed handling of dataTag with spaces

Also updated message handling, added comments.