Made some Variables local, removed redundant declarations