Fixed issue with globals. Globals are evil.