Script improvements

fixes items listed in issue #7 .  You probably want to commit my earlier pull request first.