Improved cron code