Rewritten stuff for async network, program is now in a bad state