Tidied up core.py, renaming a few of the core functions and putting in docstrings
more cleanup
Cleaned up the macro repeat-expander; wtf was that