Revert "Removed Global variables and passed them as parameters."

This reverts commit 519ab92880c11f7640c52f35a9f08a025fccb075.