good to merge once this bit is simplified.