Updated code to use ISEMPTY macros