[lipstick] Cleanup, factor out common code