finished improvements suggested by @lordnull.