updated macro for latest codetools. fixed issues. added example and example test