Use docstrings and fix iterate and cache