add "when" macro