Clean up code with a macro, add docstrings