Initial version; refurbished from graveyard code