added a macro and guards