added basic replacement-rule functionality