Added optional keyname argument.