rename function and improve docstring