Refactoring analysis.py:add()