Realised the base logic to extract scripts