Yi-nan's data structuring script