Trying to work around global variable