Refactoring of cron