modified to run from cron vs. daemon
modified to run from cron vs. daemon