diff --git a/uber_affiliate.inc b/uber_affiliate.inc
index f3fd20d..c08d71b 100644
--- a/uber_affiliate.inc
+++ b/uber_affiliate.inc
@@ -33,7 +33,7 @@ function affiliate_set_last_referrals_update() {
 function affiliate_get_new_referrals_count_raw($affid) {
   $affid = (int) $affid;
   $num_referrals = 0;
-  if (module_exists('referral')) {
+  if (\Drupal::moduleHandler()->moduleExists('referral')) {
     $lastupdate = variable_get('affiliate_module_last_referrals_update', 0);
     $num_referrals = \Drupal::database()->query("SELECT COUNT(DISTINCT(r.uid)) AS referrals FROM {referral} r INNER JOIN {users} u ON r.uid = u.uid WHERE r.referral_uid = :affid AND r.created > :lastupdate AND u.status = 1", array(":affid" => $affid, ":lastupdate" => $lastupdate))->fetchField();
   }
@@ -64,7 +64,7 @@ function affiliate_get_new_clicks_count_raw($affid) {
  * affiliate table, and set the last update time to the current time. Runs during cron.
  */
 function affiliate_update_affiliate_referrals() {
-  if (module_exists('referral')) {
+  if (\Drupal::moduleHandler()->moduleExists('referral')) {
     $affiliates = affiliate_fetch_all();
     $time = time();
     $lastupdate = variable_get('affiliate_module_last_referrals_update', 0);
@@ -486,7 +486,7 @@ function affiliate_add_click($affid, $campaign_id = 0) {
       ))
       ->execute();
       // If the Userpoints module exists, add points as configured at admin/config/people/affiliate/payouts
-      if (module_exists('userpoints')) {
+      if (\Drupal::moduleHandler()->moduleExists('userpoints')) {
         $points = (int) variable_get('affiliate_module_payouts_userpoints_clicks', 0);
         $params = array(
     	  'points' => $points,
@@ -498,7 +498,7 @@ function affiliate_add_click($affid, $campaign_id = 0) {
         userpoints_userpointsapi($params);
       }
       // Allow the Referral module to set its cookie
-      if (module_exists('referral')) {
+      if (\Drupal::moduleHandler()->moduleExists('referral')) {
         referral_set_cookie($affid);
       }
     }
@@ -1003,10 +1003,10 @@ function affiliate_admin_contentform_submit($form, $form_state) {
 
 
 function affiliate_admin_payoutsform() {
-  $userpoints_form_collapse = module_exists('userpoints') ? FALSE : TRUE;
-  $userpoints_disabled = module_exists('userpoints') ? FALSE : TRUE;
+  $userpoints_form_collapse = \Drupal::moduleHandler()->moduleExists('userpoints') ? FALSE : TRUE;
+  $userpoints_disabled = \Drupal::moduleHandler()->moduleExists('userpoints') ? FALSE : TRUE;
   $userpoints_options = function_exists('userpoints_get_categories') ? userpoints_get_categories() : array(0 => t('No categories available'));
-  $referral_form_collapse = module_exists('referral') ? FALSE : TRUE;
+  $referral_form_collapse = \Drupal::moduleHandler()->moduleExists('referral') ? FALSE : TRUE;
   $form['affiliate_module_settings']['payouts'] = array(
     '#type' => 'fieldset',
     '#title' => t('Payouts'),
