add proper macros
remove old macros
fix exception handling and history
record macro commands in history