Refactoring to drupal_alter function