Working replacement code
now we are getting somewhere