Tweaked input and output to handle demo protocol.