created function for joeys cronjob