remove by key function