Eliminated leaked global variables