Reduced the scope of variables