More error trapping, better logging, now takes path to config file as first argument