cron fixed, some refactoring