A bunch of changes that really bugged me

Please see the commit comments for more details.