(refactor and add missing "var ")