change var names, added docstring