change key variable name, add docstring