defined macro to reduce code duplication