change error logging to also go the main log file.  modify the code layout of the map/grep/glob to perform each action on one line so it is easier to read.