refactored libuv functions to io.c