Switch from select to poll, various I/O changes