Various enhancements

See commit comments for details on changes.