Miscellaneous improvements

See individual commits for more information.