Macro.py refactored.
Rebuilt documentation and refactored a bit everywhere.