simplify message parsing (statemachine)