Fix bug which stopped 'empty' macros

Also took the chance to cleanup the code a little.