Removed and replaced all globals