Modified code for globaledf