Wrap transactions, idemopotency and string substitution into a macro to avoid needing to expose internals when calling shell programs