Many changes to make module more generic for use on Drupal.org