2nd stage script improvements