fixed scope issue
removed unneeded vars