More doc strings and various function cleanups.