[WIP] Improve connection parsing

WIP, do not merge.