API rebuild, better I/O handling