made a few vars local