added macro to perform validation. the macro code is to review for duplication