two stage script added