refactored cron to allows better plugins integration