Move cron logic to a safer place