Reimplement the messy client stdout parser as a separate function