substacks can save script: uses filename of mainstack and substack