Added main logic loop for cron