dnl: code cleanup and better docstrings