Updates after figuring out variable scopes