great rewrite of all, mainly nodelay