Fix macros

- Add tests for macros.
- Re-add setting for macro that was erroneously deleted.
- Fix bug where macros appeared at end of source.