Use key variable instead of pathname