Add more useful replacement and remove redundancy code