Fix to macro so that a begin parenthesis does not cause compiler error.
Added documentation and tests.