Attach functions flexibly to keys.