Refactor cron system