improved duplicate scripts