Few changes

- added local reference because of scope issues