Minor code simplification
Adds docstrings [ci skip]