Remove unused reference variables