added var to scope functions