Changed script to be called by cron