Reimplement input functions on top of libuv

Functions that interact with `read_cmd_fd` were implemented on top libuv, using
`uv_run()` in conjunction with `UV_RUN_ONCE`.
More cleanup and improved comments