Replace rules is now a list instead of dictionary because order matters.