Add uv_stop, signal handling, etc.

Please let me know if you have questions or comments -- the commit messages should be self-explanatory.