Refactor: rewrite output stream parsing to be non blocking