parsing and generating messages