better token replacement