Several miscellaneous improvements. Still not working yet.