Rewrite to make drupalorg script easier to maintain