Something like this was added in the latest Arduino release. However it would require users to be on the latest Arduino version. What you have here is good for now. At some point I can change to use the built in macro.