made more robust, added wrapper shell script to run via cron