updated script to have Drupal Compatibility