Minor refactor; add docstring