Reduce the scope of this script to make it more useful.