Better debug stuff, still needs SIGPIPE and whatnot to be fixed...