better protocol parsing