OS X user_dir support, general minor fixes, cleanup, and expansion