De-herp code