Refactored shell scripts to work toward fully implementing #4.