Moved reading flags to the protocol.