Reverted before script, but with little optimization