Move accessory functions to a generic tools module