removed unnecessary globals